<Window x:Class="Jonathan.Interface.WikiConverter"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:monti="clr-namespace:Monti.MVVM;assembly=Monti"
        monti:DialogCloser.DialogResult="{Binding Path=DialogResult}"
        xmlns:Logic="clr-namespace:Jonathan.Logic"
        Icon="/Jonathan;component/Images/Tetrahedron.ico"
        WindowStartupLocation="CenterOwner"
        ShowInTaskbar="False"
        WindowStyle="None"
        Title="Wiki Converter"
        Height="300"
        Width="500">
   <Window.DataContext>
      <Logic:WikiConverterViewModel />
   </Window.DataContext>
   
   <Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
         <RowDefinition Height="*" />
         <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      
      <TextBlock Grid.Row="0"
                 Margin="4"
                 TextWrapping="Wrap"
                 HorizontalAlignment="Center"
                 Text="This operation will download the latest wiki dump and then convert it to databases. This file is very large (at least 55mb).
If you have a slow internet connection or computer, use the library to download books." />
      
      <Grid Grid.Row="1"
            Margin="4">
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
         </Grid.ColumnDefinitions>
         <TextBlock Text="Status:"
                    Grid.Column="0" />
         <TextBlock Text="{Binding Path=Status}"
                    Grid.Column="1"
                    TextWrapping="Wrap"
                    Margin="4,0,0,0"/>
      </Grid>
      
      <Grid Grid.Row="2"
            Margin="4">
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="150px" />
            <ColumnDefinition Width="*" />
         </Grid.ColumnDefinitions>
         <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
         </Grid.RowDefinitions>
         
         <TextBlock Text="Unknown pages"
                    FontWeight="Bold"
                    Grid.Column="0" />
         <TextBlock Text="Converted Books"
                    Margin="4,0,0,0"
                    FontWeight="Bold"
                    Grid.Column="1"/>
         
         <ListBox Grid.Column="0"
                  Grid.Row="1"
                  ItemsSource="{Binding Path=UnknownPages}" />
         <Grid Grid.Column="1"
               Grid.Row="1"
               Margin="4,0,0,0">
            <Grid.RowDefinitions>
               <RowDefinition Height="*" />
               <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="Auto" />
               <ColumnDefinition Width="Auto" />
               <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <ListBox Grid.Column="0"
                     Grid.Row="0"
                     Grid.ColumnSpan="3"
                     ItemsSource="{Binding Path=ConvertedBooks}">
               <ListBox.ItemTemplate>
                  <HierarchicalDataTemplate>
                     <CheckBox Content="{Binding Path=Name}"
                               IsChecked="{Binding Path=IsChecked}" />
                  </HierarchicalDataTemplate>
               </ListBox.ItemTemplate>
            </ListBox>
            <CheckBox Grid.Row="1"
                      Margin="4,0,0,0"
                      VerticalAlignment="Center"
                      Grid.Column="0"
                      IsChecked="{Binding Path=CopyAll}"
                      IsEnabled="{Binding Path=CanCopy}"/>
            <Button Width="100px"
                    Margin="4"
                    Grid.Row="1"
                    Grid.Column="1"
                    CommandParameter="Copy"
                    Command="{Binding Path=ActionCommand}">
               <Button.Content>
                  <StackPanel Orientation="Horizontal">
                     <Image Source="/Jonathan;component/Images/page_copy.png" />
                     <TextBlock Text="Copy to Local"
                                Margin="4" />
                  </StackPanel>
               </Button.Content>
            </Button>
            <TextBlock Grid.Row="1"
                       Grid.Column="2"
                       FontSize="10"
                       TextWrapping="Wrap"
                       VerticalAlignment="Center"
                       IsEnabled="{Binding Path=CanCopy}"
                       Text="Copies the selected books to use in Jonathan" />
         </Grid>
      </Grid>
   
      <StackPanel Grid.Row="3"
                  Margin="4"
                  Orientation="Horizontal"
                  HorizontalAlignment="Center">
         <Button Width="100px"
                 Command="{Binding Path=ActionCommand}"
                 CommandParameter="Convert">
            <Button.Content>
               <StackPanel Orientation="Horizontal">
                  <Image Source="/Jonathan;component/Images/arrow_branch.png" />
                  <TextBlock Text="Convert"
                             Margin="4" />
               </StackPanel>
            </Button.Content>
         </Button>
         <Button Width="100px"
                 Margin="4,0,0,0"
                 Command="{Binding Path=OkCommand}">
            <Button.Content>
               <StackPanel Orientation="Horizontal">
                  <Image Source="/Jonathan;component/Images/cancel.png" />
                  <TextBlock Text="Close"
                             Margin="4" />
               </StackPanel>
            </Button.Content>
         </Button>
      </StackPanel>
   </Grid>
</Window>